<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/chioce.css"/>




    <style>
        .form-control {
            width: 50%;
        }
        .has-switch span, .has-switch label {
            height: auto;
        }
        .table-bordered>tbody>tr>td{
            padding-left: 32px;
        }
        .ng-scope input {
            width: 82px;
            height: 34px;
            position: absolute;
            left: 0;
            top: 10px;
            opacity: 0;
            cursor: pointer;
        }
    </style>
</head>
<body>
{include file='public/header'/}
<section>
    <!------------------导航-------------------------->
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgr15 mgl15">
            <ul class="breadcrumb">
                <li>当前位置是：</li>
                <li><a href="{:url('cardus/cardinfo',['card_id'=>$card['card_id']])}">会员卡</a></li>
                <li><a href="{:url('shop/shopmall',['card_id'=>$card['card_id']])}"> 积分商城</a></li>
                <li><a href="javascript:history.back();">商品列表</a></li>
                <li class="active" style="color: #02b87f;">商品添加</li>
            </ul>
        </div>
        <div class="panel mgr15 mgl15">
            <div class="panel-heading addCharts" style="background:#ededed;">
                添加商品
            </div>
            <div class="panel-body">
                <form class="form-horizontal adminex-form" action="" method="post">
                    <input type="hidden" name="card_id" value="">
                    <div class="panel panel-default" id="step1">
                        <div class="panel-body">
                            <div class="pull-left alert form form-area col-sm-12 col-md-12 "style="display: block; margin-top: 0.5px;" id="form1">


                                <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">类目名称：</label>
                                    <div class="col-sm-9 col-xs-12 coupon-color">
                                        <input type="text" class="form-control"  name="name" id="goods_name">
                                    </div>
                                </div>


                                <div style="text-align: center">
                                    <button type="button" class="btn btn-primary" id="add">添加</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
<!--获取会员卡列表-->
<!-- Modal -->
</body>
<script>
//       提交数据
        $("#add").click(function(){
            console.log(12);
            var name = $("#name").val();

            if(name == ""){
                layer.alert("名称不能为空");
                return false;
            }

            $.ajax({
                //几个参数需要注意一下
                type: "POST",//方法类型
                dataType: "json",//预期服务器返回的数据类型
                url: "{:url('')}" ,//url
                data: $('.adminex-form').serialize(),
                success: function (res) {
                    console.log(res);
                    if (res.code == 0) {
                        layer.msg('添加成功');
                        setTimeout(function(){
                            window.location.href=res.url
                        },1000);

                    }else{
                        layer.msg('添加失败');
                    }
                },
                error : function() {
                    alert("异常！");
                }
            });
        });


</script>



</html>
